#!/usr/bin/python3

from urllib import request

import bs4

print('---start---\n')

webRoot = 'https://wap.ithome.com/'

# GET 网页内容
req = request.Request(webRoot)

resp = request.urlopen(req)
html_text = resp.read().decode('utf-8')
# print(html_text)

soup = bs4.BeautifulSoup(html_text, "html.parser")

news_list = soup.find(id='jsonplist')
print(news_list)

for soup_tag in news_list.find_all(name='li'):
    print(soup_tag)
    print(soup_tag.find(name='a').get('href'))
    print(soup_tag.find(name='script').string)
    print(soup_tag.find(class_='title').string)
    pass



